<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>注册</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">

  <script th:inline="javascript">
    /*<![CDATA[*/
    $(document).ready(function() {
      setTimeout(function() {
        $('#msg').hide();
      }, 3000); // 3000 milliseconds = 3 seconds
    });
    /*]]>*/
  </script>



  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f0f0f0;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
    }
    .container {
      background-color: #fff;
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
      width: 300px;
    }
    .container h1 {
      text-align: center;
      margin-bottom: 20px;
    }
    .input-box {
      margin-bottom: 20px;
      position: relative;
      border: 1px solid #ddd;
      border-radius: 10px;
      padding: 10px;
    }
    .input-box input {
      width: calc(100% - 40px);
      padding: 10px 40px 10px 15px;
      border: none;
      border-radius: 10px;
      font-size: 16px;
    }
    .input-box i {
      position: absolute;
      top: 12px;
      right: 15px;
      color: #999;
    }
    .btn {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 10px;
      background-color: #6495ed;
      color: #fff;
      font-size: 16px;
      cursor: pointer;
    }
    .btn:hover {
      background-color: #4682b4;
    }
    .btn-cancel {
      width: 100%;
      padding: 10px;
      border: none;
      border-radius: 10px;
      background-color: #f0f0f0;
      color: #333;
      font-size: 16px;
      cursor: pointer;
      margin-top: 10px;
    }
    .btn-cancel:hover {
      background-color: #e0e0e0;
    }
  </style>
</head>
<body>
<div class="container">
  <h1>添加管理员信息</h1>
  <form th:action="@{/registerAdmin}" method="post">
    <div class="input-box">
      <input type="text" id="r_mobile" name="r_mobile" placeholder="手机号" required>
      <i class="fas fa-user"></i>
    </div>
    <div class="input-box">
      <input type="password" id="r_password" name="r_password" placeholder="密码" required>
      <i class="fas fa-lock"></i>
    </div>
    <div class="input-box">
      <input type="text" id="r_nickname" name="r_nickname" placeholder="昵称" required>
      <i class="fas fa-user"></i>
    </div>
    <br>
    <p id="msg" th:text="${msg}" th:style="'color: red;'"></p>
    <button type="submit" class="btn">确定</button>
    <button type="button" class="btn-cancel" onclick="cancelRegistration()">取消</button>
  </form>
</div>

<script>
  function cancelRegistration() {
    window.location.href = "/toAdminPage"; // 跳转到管理员页面
  }
</script>
</body>
</html>